/**
**通用删除方法支持多选
**@grid 表格
**@id_field 主键id
**@deleteUrl 删除url
**/
function deleteHandler(grid,id_field,deleteUrl){
    var records = grid.getSelectionModel().getSelection();
    if(records.length == 0){
        Ext.Msg.alert("信息提示","请选择需要删除的数据！");
        return;
    }
    Ext.MessageBox.confirm('信息提示','确认删除吗？',function(val){
        if(val == 'yes'){
            var ids = '';
            for(var i=0;i<records.length;i++){
                if(i==0)
                    ids = records[0].get(id_field);
                else
                    ids = ids + ',' + records[i].get(id_field);
            }
            Ext.Ajax.request({
                url: deleteUrl+'/'+ids,
                method : 'POST',
                success: function(response, opts) {
                    var data = eval("("+response.responseText+")");
                    if(data.success){
                        Ext.Msg.alert('信息提示',data.msg,function(){
                            grid.getStore().reload();
                        });
                    } else {
                        Ext.Msg.alert('信息提示',data.msg);
                    }
                },
                failure: function(response, opts) {
                    var data = eval("("+response.responseText+")");
                    if(!data.success){
                        Ext.Msg.alert('错误',data.msg);
                    } else {
                        Ext.Msg.alert("错误","系统忙，请稍候再试");
                    }
                }
            });
        }
    });
}